WWL.button = function ( name )
{
	var btn = new WWL ( 'button', name );

	btn.tooltip = false;

	btn.to_string = function ()
	{
		var s = '', id;
		/*var disabled = ( this._is_disabled ? 
			( this.class_name ?  this.class_name + "_disabled" : "disabled"  ) : this.class_name ) */

		s = '<div class="wwl_' + this.type + '" id="' + this.id + '"'; //>';
		s += this.mk_events ();
		s += '><div id="' + this.id + ':content" ';

		if ( this.tooltip ) s += ' title="' + this.tooltip.striphtml () + '"';

		s += ' onselectstart="return false;" style="-moz-user-select: none"';
                s += ' class="' + WWL.mk_class_str ( this, ( this._is_disabled ? "disabled" : null ) ) + '">';
		s += this.label;
                s += '</div></div>';

		return s;
	};

	btn._int_events = {};

	btn._int_events [ 'over' ]     = function ( widget, div ) { WWL.button._set_class ( widget, div, "hover" ); };
	btn._int_events [ 'btn_down' ] = function ( widget, div ) { WWL.button._set_class ( widget, div, "click" ); };
	btn._int_events [ 'btn_up' ]   = function ( widget, div ) { WWL.button._set_class ( widget, div, "hover" ); }; 
	btn._int_events [ 'click' ]    = function ( widget, div ) { WWL.button._set_class ( widget, div, "hover" ); };
	btn._int_events [ 'out' ]      = function ( widget, div ) { WWL.button._set_class ( widget, div ); };

	return btn;
};

WWL.button.get_instance = function ( instance_name )
{
	return WWL.get_instance ( "button", instance_name );
};

// This is an internal function for button class only
WWL.button._set_class = function ( widget, div, class_name ) 
{ 
	div.firstChild.className = WWL.mk_class_str ( widget, class_name );
};
